<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>create</title>
</head>

<body>
    <script src="../src/ajax.js"></script>
    <script>
        var ajax = Ajax.create({
            baseURL: '/base/',
            params: {
                foo: {
                    bar: 'baz'
                }
            },
            data: {
                a: 1,
                b: 2
            },
        })

        ajax({
            method: 'get',
            url: '/get',
            before: function (config) {
                console.log('1-get-before', config)
            },
            after: function (response) {
                console.log('1-get-after', response)
            },
        })

        ajax({
            method: 'post',
            url: '/post',
            before: function (config) {
                console.log('1-post-before', config)
            },
            after: function (response) {
                console.log('1-post-after', response)
            },
        })

        ajax.get('/get', function(response){
            console.log('2-get-after', response)
        })
        ajax.post('/post', function(response){
            console.log('2-post-after', response)
        })
    </script>
</body>

</html>